//
//  MyPointsMask.m
//  BaseProject
//
//  Created by 王盼盼 on 2024/11/7.
//  Copyright © 2024 wangpanpan. All rights reserved.
//

#import "MyPointsMask.h"

@interface MyPointsMask ()
@property(nonatomic, strong) UIImageView *tipImageView;
@property(nonatomic, strong) UILabel *tipLabel;
@end

@implementation MyPointsMask
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self addTarget:self action:@selector(clickTap:) forControlEvents:UIControlEventTouchUpInside];
    }
    return self;
}
- (void)setTipPoint:(CGPoint)tipPoint {
    _tipPoint = tipPoint;
    [self addSubview:self.tipImageView];
    [self.tipImageView addSubview:self.tipLabel];
    
    self.tipImageView.frame = CGRectMake(tipPoint.x - (153 * 0.5), tipPoint.y, 153, 62);
    [self.tipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(17);
        make.right.mas_equalTo(-10);
    }];
    
    self.tipLabel.text = @"冻结的积分，需要在订单完成45天后可使用";
}
- (void)clickTap:sender {
    [self removeFromSuperview];
}
#pragma mark - lazy
- (UIImageView *)tipImageView {
    if (!_tipImageView) {
        UIImageView *iv = [[UIImageView alloc]init];
        iv.image = [UIImage imageNamed:ImageName.credit_qipao];
        _tipImageView = iv;
    }
    return _tipImageView;
}
- (UILabel *)tipLabel {
    if (!_tipLabel) {
        UILabel *lab = [[UILabel alloc]init];
        lab.font = kFontRegular(12);
        lab.textColor = rgba(47, 47, 52, 1);
        lab.textAlignment = NSTextAlignmentLeft;
        lab.numberOfLines = 0;
        _tipLabel = lab;
    }
    return _tipLabel;
}
@end
